aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/(profile)
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-02-02 23:26:34 -0800
committerAdam Soltys <[email protected]>2023-02-02 23:29:42 -0800
commit9a53b429daf44da7a4272db56350ef32ca494de5 (patch)
treea2dc51e4f16fab464788c54dd60e6c18dc8923b0 /src/routes/(app)/[username]/(profile)
parent4eb51e283cc88e7c3e81718d917fa263d8fae65c (diff)
downloadcoinos-ui-9a53b429daf44da7a4272db56350ef32ca494de5.tar.gz
coinos-ui-9a53b429daf44da7a4272db56350ef32ca494de5.zip
move invoices, combine profile and dashboard
Diffstat (limited to 'src/routes/(app)/[username]/(profile)')
-rw-r--r--src/routes/(app)/[username]/(profile)/+layout.svelte99
-rw-r--r--src/routes/(app)/[username]/(profile)/+page.svelte24
-rw-r--r--src/routes/(app)/[username]/(profile)/followers/+page.svelte2
-rw-r--r--src/routes/(app)/[username]/(profile)/follows/+page.svelte2
4 files changed, 84 insertions, 43 deletions
diff --git a/src/routes/(app)/[username]/(profile)/+layout.svelte b/src/routes/(app)/[username]/(profile)/+layout.svelte
index 6528d688..b318d777 100644
--- a/src/routes/(app)/[username]/(profile)/+layout.svelte
+++ b/src/routes/(app)/[username]/(profile)/+layout.svelte
@@ -1,12 +1,15 @@
<script>
+ import { f, s, sats } from '$lib/utils';
+ import { animatedRate, selectedRate } from '$lib/store';
import { Icon } from '$comp';
import { t } from '$lib/translations';
import { sign, send } from '$lib/nostr';
+ import { v4 } from 'uuid';
export let data;
let events, user, subject, src, text;
$: ({ events, user, subject, src, text } = data);
- $: ({ username: n, display } = subject);
+ $: ({ currency, username: n, display } = subject);
$: username = n.length > 60 ? n.substr(0, 6) : display || n;
@@ -39,12 +42,30 @@
};
$: following = !!user?.follows.find((t) => t.includes(subject.pubkey));
+
+ let ease = (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t);
+ let i;
+
+ let o = $selectedRate;
+ $: animate($selectedRate);
+ let animate = (n) => {
+ clearInterval(i);
+
+ let t = 0;
+ let d = o - n;
+
+ i = setInterval(() => {
+ $animatedRate = (o - d * ease(t / 100)).toFixed(2);
+ if (t > 80) (o = n) && clearInterval(i);
+ t++;
+ }, 10);
+ };
</script>
-<div class="container mx-auto w-full px-4 mb-4 flex flex-wrap md:flex-nowrap">
- <div class="hidden lg:block w-[240px] md:mr-10" />
- <div class="w-[240px] lg:absolute pt-20 space-y-5 left-20 mx-auto md:mr-10">
- <h1 class="text-3xl font-bold text-center mx-auto lg:text-left">{display || username}</h1>
+<div class="container mx-auto w-full px-4 mb-4 flex flex-wrap lg:flex-nowrap">
+ <div class="hidden lg:block w-[240px] lg:mr-10" />
+ <div class="w-[240px] lg:absolute space-y-5 left-20 mx-auto lg:mr-10 mb-10">
+ <h1 class="text-3xl font-bold text-center mx-auto">{display || username}</h1>
<div class="text-secondary mx-auto text-center lg:text-left lg:mx-0">
{subject.address && subject.address !== 'null' ? subject.address : ''}
@@ -100,7 +121,7 @@
</a>
</div>
{/if}
- {#if !subject.anon}
+ {#if !subject.anon && subject.username !== user?.username}
<div class="w-full flex">
<a href={`/${subject.username}/receive`} class="mx-auto">
<button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60">
@@ -111,26 +132,64 @@
</button>
</a>
</div>
+ {/if}
- <!-- {#if user?.username !== subject.username} -->
- <!-- <div class="w-full flex"> -->
- <!-- <a href={`/${subject.username}/request`} class="mx-auto"> -->
- <!-- <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60"> -->
- <!-- <div class="mx-auto flex"> -->
- <!-- <Icon icon="support" style="mr-1" /> -->
- <!-- <div>{$t('payments.requestAnInvoice')}</div> -->
- <!-- </div> -->
- <!-- </button> -->
- <!-- </a> -->
- <!-- </div> -->
- <!-- {/if} -->
+ {#if user?.id === subject.id}
+ <div class="w-full flex">
+ <a href={`/send`} class="mx-auto">
+ <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60">
+ <div class="mx-auto flex">
+ <Icon icon="send" style="mr-2" />
+ <div class="mt-1">{$t('user.dashboard.send')}</div>
+ </div>
+ </button>
+ </a>
+ </div>
+ <div class="w-full flex">
+ <a href={`/${subject.username}/receive`} class="mx-auto">
+ <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60">
+ <div class="mx-auto flex">
+ <Icon icon="numpad" style="mr-2" />
+ <div class="mt-1">{$t('user.dashboard.receive')}</div>
+ </div>
+ </button>
+ </a>
+ </div>
+ <!-- <div class="w-full flex"> -->
+ <!-- <a href={`/${subject.username}/receive`} class="mx-auto"> -->
+ <!-- <button class="rounded-full border py-3 px-6 font-bold hover:opacity-80 flex w-60"> -->
+ <!-- <div class="mx-auto flex"> -->
+ <!-- <Icon icon="support" style="mr-2" /> -->
+ <!-- <div class="mt-1">{$t('user.messages')}</div> -->
+ <!-- </div> -->
+ <!-- </button> -->
+ <!-- </a> -->
+ <!-- </div> -->
{/if}
</div>
</div>
- <div class="w-full md:pt-12 lg:pt-0">
- <div class="mx-auto space-y-5 mt-5 lg:max-w-lg xl:max-w-2xl">
+ <div class="w-full">
+ <div class="mx-auto space-y-5 lg:max-w-lg xl:max-w-2xl">
<slot />
</div>
</div>
</div>
+
+{#if currency && $animatedRate}
+ <div class="flex fixed w-full px-4 bg-white py-2 bottom-0 bg-opacity-90 tabular-nums">
+ <div class="text-secondary flex mr-auto">
+ <div class="flex mr-1">
+ <div class="my-auto mr-1">1</div>
+ <img src="/images/bitcoin.svg" class="w-5 my-auto" alt="Bitcoin" />
+ </div>
+ <div>= {f($animatedRate, currency)}</div>
+ </div>
+ <div class="text-secondary flex ml-auto">
+ <div class="flex">
+ <div class="mr-1">⚡️{s((1 * sats) / $animatedRate)} =</div>
+ <div>{f(1, currency)}</div>
+ </div>
+ </div>
+ </div>
+{/if}
diff --git a/src/routes/(app)/[username]/(profile)/+page.svelte b/src/routes/(app)/[username]/(profile)/+page.svelte
index f9ded033..40c73ea4 100644
--- a/src/routes/(app)/[username]/(profile)/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/+page.svelte
@@ -1,29 +1,11 @@
<script>
- import { Feed } from '$comp';
+ import { Balance, Feed } from '$comp';
import { t } from '$lib/translations';
export let data;
let { events, subject, user } = data;
</script>
-<!-- <div class="font-bold flex justify-around items-center border-b pb-3 text-secondary mt-20"> -->
-<!-- <a href={`/${user.username}`}> -->
-<!-- <button class="hover:opacity-80 uppercase" class:text-black={true}> -->
-<!-- {$t(`user.notes`)} -->
-<!-- </button> -->
-<!-- </a> -->
-<!-- <a href={`/${user.username}`}> -->
-<!-- <button class="hover:opacity-80 uppercase"> -->
-<!-- {$t(`user.feed`)} -->
-<!-- </button> -->
-<!-- </a> -->
-<!-- <a href={`/${user.username}`}> -->
-<!-- <button class="hover:opacity-80 uppercase"> -->
-<!-- {$t(`user.messages`)} -->
-<!-- </button> -->
-<!-- </a> -->
-<!-- </div> -->
-
-<div class="mt-20">
- <Feed {events} user={subject?.username === user?.username && user} />
+<div class="flex justify-center lg:justify-start">
+ <Balance {user} />
</div>
diff --git a/src/routes/(app)/[username]/(profile)/followers/+page.svelte b/src/routes/(app)/[username]/(profile)/followers/+page.svelte
index 87a3b947..77b337b6 100644
--- a/src/routes/(app)/[username]/(profile)/followers/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/followers/+page.svelte
@@ -13,7 +13,7 @@
<svelte:window bind:innerWidth={w} />
-<div class="mt-24 mb-20 px-3 md:px-0 w-full md:w-[400px] mx-auto space-y-8">
+<div class="px-3 md:px-0 w-full md:w-[400px] mx-auto space-y-8">
<h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Followers</h1>
{#if browser}
diff --git a/src/routes/(app)/[username]/(profile)/follows/+page.svelte b/src/routes/(app)/[username]/(profile)/follows/+page.svelte
index 97269f45..78566fc4 100644
--- a/src/routes/(app)/[username]/(profile)/follows/+page.svelte
+++ b/src/routes/(app)/[username]/(profile)/follows/+page.svelte
@@ -12,7 +12,7 @@
<svelte:window bind:innerWidth={w} />
-<div class="mt-24 mb-20 px-3 md:px-0 w-full md:w-[400px] mx-auto space-y-8">
+<div class="px-3 md:px-0 w-full md:w-[400px] mx-auto space-y-8">
<h1 class="px-3 md:px-0 text-center text-3xl md:text-4xl font-semibold">Following</h1>
{#if browser}